package com.common.util;


import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;

import com.staff.entity.Staff;


public class AuthenticationUtil {
	
	public static void authenticationLogin(Staff staff){
		
        //登录后存放进shiro token
        UsernamePasswordToken token=new UsernamePasswordToken(staff.getStaffNum(),staff.getPassword());
        Subject subject=SecurityUtils.getSubject();
        System.out.println("subject:"+subject);
        try {
       	 subject.login(token);
		} catch (Exception e) {
			throw e;
		}
	}
}
